home *** CD-ROM | disk | FTP | other *** search
/ Komputer for Alle 2002 #4 / K-CD-4-2002.ISO / Empire Earth / EEDemo.exe / Disk1 / data.ssa / unit ai scripts_generic movement.tai < prev    next >
Encoding:
Text File  |  2001-09-29  |  4.0 KB  |  138 lines

  1. //
  2. //    Generic Movement AI file
  3. //
  4. //    Behaviors:
  5. //
  6. //        Path to a location.
  7. //
  8. //    Notes:
  9. //
  10. //    Common modifications:
  11. //
  12. //        To test a trigger at each waypoint, place a GetNextMoveWaypoint transition specification before
  13. //            including this file.
  14. //        To test a trigger at every movement step, place an Advance transition specification before
  15. //            including this file.  BEWARE:  this trigger will potentially be tested MANY times a second.
  16. //
  17. //    Known Problems:
  18. //
  19. //    Usage:
  20. //
  21. //        To tell a unit to move to a location, give it a location goal (EEUGLocation) and set it's action
  22. //            to keeuaPrepareToMove.
  23. //
  24.  
  25. // is pathfinding complete?
  26. PrepareToMove
  27. {
  28.     allof(GoalIsLoadContainer,ContainerInRange) true(WaitForTransport)
  29.     NoMoreWaypoints true(TurnToUnitFacing)
  30.     MovePreparationComplete true(LookForEnemies)
  31. }
  32.  
  33. // are we at a waypoint?
  34. Advance
  35. {
  36.     ArrivedAtMoveWaypoint true(GetNextMoveWaypoint)
  37.     ObstacleDetected true(RepathAroundObstacle)
  38.     allof(OneWaypointRemaining,GoalIsUnit) true(ReacquireEnemyUnit)
  39. }
  40.  
  41. RepathAroundObstacle
  42. {
  43.     MovePreparationComplete true(Advance) false(ShouldIReturnToInitialContactLocation)
  44. }
  45.  
  46. // gets the next location
  47. GetNextAutoWaypoint
  48. {
  49.     UnitHasGoal true(PrepareToMove) false(ShouldIReturnToInitialContactLocation)
  50. }
  51.  
  52. // look for new waypoints and detect the end of the path
  53. GetNextMoveWaypoint
  54. {
  55.     allof(GoalIsLoadContainer,NextWaypointRetrieved) true(GetContainerProgress)
  56.     ShouldMoveToNextAutoWaypoint true(GetNextAutoWaypoint)
  57.     NextWaypointRetrieved true(LookForEnemies) false(TurnToUnitFacing)
  58. }
  59.  
  60. // turn to unit facing as specified in the location goal, if required
  61. TurnToUnitFacing
  62. {
  63.     GoalIsLoadContainer true(GetContainerProgress)
  64.     anyof(UnitFacingNotRequired,CompletedUnitFacing) true(ReacquireGoal)
  65.     UnitHasGoal false(ReacquireGoal)
  66. }
  67.  
  68. // should i return to the initial contact location?
  69. ShouldIReturnToInitialContactLocation
  70. {
  71.     allof(HasValidInitialContactLocation,ReturnsToInitialContactLocation,GoalIsNotPlayerInitiated) true(ReturnToInitialContactLocation) false(Idle)
  72. }
  73.  
  74. // triggers unit to return back to it's initial contact location
  75. ReturnToInitialContactLocation
  76. {
  77.     AlwaysTrue true(PrepareToMove)
  78. }
  79.  
  80. // the order of these two specifications is important, since the false case of the second one can only be done once
  81. LookForEnemies
  82. {
  83.     allof(CanITargetEnemies,GoalIsPatrol,EnemyUnitSpotted) true(CheckRange)
  84.     allof(GoalIsLocation,AttackMoveEnabled,EnemyUnitSpotted) true(CheckRange)
  85.     allof(CanITargetEnemies,GoalIsNotPlayerInitiated,GoalIsNotAttack,EnemyUnitSpotted) true(CheckRange) false(Advance)
  86. }
  87.  
  88. // we've reached the end of the path
  89. // if no goals, ShouldIReturnToInitialContactLocation will figure out what to do
  90. ReacquireGoal
  91. {
  92.     GoalIsLocation true(Idle)
  93.     GoalIsExplore true(FindUnexploredArea)
  94.     GoalIsLoadContainer true(ReacquireLoadContainer)
  95.     UnitHasGoal false(ShouldIReturnToInitialContactLocation)
  96. }
  97.  
  98. // just for transport/garrison loading 
  99. ReacquireLoadContainer
  100. {
  101.     ContainerInRange true(WaitForTransport) false(PrepareToMove)
  102. }
  103.  
  104. FindUnexploredArea
  105. {
  106.     SearchingForAreaToExplore true(FindUnexploredArea)
  107.     NoUnexploredAreasLeft true(Idle) false(PrepareToMove)
  108. }
  109.  
  110. // for passengers only - assumption is that unit is a passenger
  111. LoadIntoContainer
  112. {
  113.     LoadableUnitLoaded true(Idle)
  114. }
  115.  
  116. // for passengers only - assumption is that unit is a passenger - order is important
  117. GetContainerProgress
  118. {
  119.     ContainerIsDead true(Idle)
  120.     ContainerHasLostGoal true(Idle)
  121.     ContainerInRange true(LoadIntoContainer)
  122.     allof(GoalIsLoadContainer,NoMoreWaypoints,HaveNotReachedRendezvousPoint) true(PrepareToMove)
  123.     allof(GoalIsLoadContainer,NoMoreWaypoints,HaveReachedRendezvousPoint) true(WaitForTransport)
  124.     NoMoreWaypoints true(PrepareToMove) false(Advance)
  125. }
  126.  
  127. WaitForTransport
  128. {
  129.     ContainerIsDead true(Idle)
  130.     ContainerHasLostGoal true(Idle)
  131.     ContainerInRange true(LoadIntoContainer)
  132.     allof(NoMoreWaypoints,ContainerHasNoMoreWaypoints) true(CannotReachContainer)
  133. }
  134.  
  135. CannotReachContainer
  136. {
  137.     AlwaysTrue true(PrepareToMove)
  138. }